package Classes.GameViews.ViewIcons
{
	import Classes.GameViews.GameView;
	import Classes.Interfaces.I_NeedSWFSource;
	import Classes.Managers.M_LoadSWFSource;
	
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.system.ApplicationDomain;
	
	/** 
	 * 单独加载Swf 到页面中
	 * @author thy
	 * @version 1.0.0 
	 * 创建时间：Mar 30, 2012 11:20:03 AM 
	 */ 
	public class VI_SingleLoadSwfIcon extends GameView implements I_NeedSWFSource
	{
		private var _sourceName:String;
		private var _picName:String;
		private var _sourcePath:String;
		/**
		 * 加载SWF 
		 * @param sourceName 资源名(自取)	
		 * @param picName    资源里面的名称
		 * @param sourcePath 资源地址
		 */		
		public function VI_SingleLoadSwfIcon(sourceName:String,picName:String,sourcePath:String="")
		{
			this._sourceName=sourceName;
			this._picName=picName;
			this._sourcePath=sourcePath;
			this.init();
		}
		
		private function init():void
		{
			M_LoadSWFSource.instance.needLoad(this,this.sourcePath,this.sourceName,true)
		}
		
		public function sourceLoadOver(sourceName:String):void
		{
			var mcCartoon:DisplayObject=new (ApplicationDomain.currentDomain.getDefinition(this.picName) as Class);
			this.addChildAt(mcCartoon,0);
		}

		public function get sourceName():String
		{
			return _sourceName;
		}

		public function set sourceName(value:String):void
		{
			_sourceName = value;
		}

		public function get picName():String
		{
			return _picName;
		}

		public function set picName(value:String):void
		{
			_picName = value;
		}

		public function get sourcePath():String
		{
			return _sourcePath;
		}

		public function set sourcePath(value:String):void
		{
			_sourcePath = value;
		}


	}
}
